
cc.Class({
    extends: cc.Component,

    properties: {
    

    },

    // LIFE-CYCLE CALLBACKS:

     onLoad () {

     },

     init:function(type){
        this.node.type = type;
        this.speed = 1.5;
        this.node.y = cc.winSize.height / 2 + this.node.height / 2;
        var randomx = window.Global.getRandom(-cc.winSize.width / 2 + this.node.width / 2,cc.winSize.width / 2 - this.node.width / 2);
        this.node.x = randomx;
        
       },

    start () {

    },

    onCollisionEnter:function(other,self){
            
           if(other.node.group == "bullet"){
               other.node.destroy();
           }else{
             self.node.destroy();  
           }          
        },
    

     update (dt) {
      this.node.y -= this.speed;
      if(this.node.y < -cc.winSize / 2 - this.node.height / 2){
        window.Global.destroyNode(this.node);  
    }
     },
});
